<?php

namespace App\Modules\Apicrzs\Http\Controllers;

use App\Modules\Apicrzs\Services\UsersServices;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class UsersController extends BaseApicrzsController
{

    public function __construct(UsersServices $authService)
    {
        $this->service = $authService;
    }
    public function details(Request $request): JsonResponse
    {
        $data = $this->service->details($request->all());
        return $this->sendApiSuccess($data);
    }
    public function update(Request $request): JsonResponse
    {
        $result = $this->service->update($request->all());
        if ($result){
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }
    public function verification(Request $request): JsonResponse
    {
        $result = $this->service->verification($request->all());
        if ($result){
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }
    public function binding(Request $request): JsonResponse
    {
        $data = $this->service->binding($request->all());
        return $this->sendApiSuccess($data);
    }
}
